// Copyright Epic Games, Inc. All Rights Reserved.

#include "WorldAudioMassEntityTrait.h"
#include "MassEntityManager.h"
#include "MassEntityTemplateRegistry.h"
#include "Engine/World.h"
#include "MassEntityUtils.h"

void UWorldAudioDataMassEntityTrait::BuildTemplate(FMassEntityTemplateBuildContext& BuildContext, const UWorld& World) const
{
	FWorldAudioDataAudioControllerParameters AudioControllerFragment;
	AudioControllerFragment.AudioController = AudioController;

	FMassEntityManager&      EntityManager  = UE::Mass::Utils::GetEntityManagerChecked(World);
	const FConstSharedStruct AudioControllerSharedFragment = EntityManager.GetOrCreateConstSharedFragment(AudioControllerFragment); // Add config as shared fragment

	BuildContext.AddConstSharedFragment(AudioControllerSharedFragment);
}

